package com.wxy.demo.design_pattern.observer;

/**
 * <p>
 *
 * </p>
 *
 * @author e-Xiaoyuan.Wang
 * @since 2022/9/8 9:50
 */
public class Demo {
    public static void main(String[] args) {
        //创建一个主题
        ConcreteSubject subject = new ConcreteSubject();
        //定义一个观察者
        Observer observer1 = new ConcreteObserver1();
        Observer observer2 = new ConcreteObserver2();
        //注册观察者
        subject.addObserver(observer1);
        subject.addObserver(observer2);
        //开始活动
        subject.doSomething();
    }
}
